package service.impl;

import bean.BookBean;
import dao.IBookDao;
import org.apache.ibatis.session.SqlSession;
import service.IBookService;
import util.SqlSessionUtil;

import java.util.List;

public class BookServiceImpl  implements IBookService {

    private SqlSession sqlSession = SqlSessionUtil.getSqlSession();

    @Override
    public List<BookBean> showAllBooksInfo() {

      IBookDao iBookDao = sqlSession.getMapper(IBookDao.class);


        return iBookDao.getAllBook();
    }

    @Override
    public BookBean showBookDetailInfo(int bookId) {

        IBookDao iBookDao = sqlSession.getMapper(IBookDao.class);

        return iBookDao.getBookById(bookId);

    }
}
